package com.example.idachuappone.promptly.dao;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class DBHelper extends SQLiteOpenHelper {
	public DBHelper(Context context) {
		super(context, "AddressHistory.db", null, 2);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL("create table addresshis(_id integer primary key autoincrement,name varchar(100),address varchar(200),position varchar(200))");
		db.execSQL("create table cook(_id integer primary key autoincrement,id varchar(10),name varchar(50),head_small varchar(100),location varchar(100),star varchar(10),bespeak_num varchar(20),recname varchar(20),recimg varchar(100),tag varchar(50))");
		db.execSQL("create table initdata(activityname varchar(100),init CLOB)");
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		Log.e("aaaaaaaaa", new StringBuilder(String.valueOf(oldVersion)).toString());
		switch (oldVersion + 1) {
		case 1 /* 1 */:
			db.execSQL("create table addresshis(_id integer primary key autoincrement,name varchar(100),address varchar(200),position varchar(200))");
			db.execSQL("create table cook(_id integer primary key autoincrement,id varchar(10),name varchar(50),head_small varchar(100),location varchar(100),star varchar(10),bespeak_num varchar(20),recname varchar(20),recimg varchar(100),tag varchar(50))");
			break;
		case 2 /* 2 */:
			break;
		default:
			return;
		}
		db.execSQL("create table initdata(activityname varchar(100),init CLOB)");
	}
}
